home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / DEMON / RISCOS2 / ARCKA9Q1.ARC / h / UDP < prev   
Text File  |  1992-02-15  |  2KB  |  54 lines

  1. /* User Datagram Protocol definitions */
  2.  
  3. #define NUDP    20
  4.  
  5. /* Structure of a UDP protocol header */
  6. struct udp {
  7.         int16 source;   /* Source port */
  8.         int16 dest;     /* Destination port */
  9.         int16 length;   /* Length of header and data */
  10.         int16 checksum; /* Checksum over pseudo-header, header and data */
  11. };
  12. #define UDPHDR  8       /* Length of UDP header */
  13.  
  14. /* User Datagram Protocol control block
  15.  * Each entry on the receive queue consists of the
  16.  * remote socket structure, followed by any data
  17.  */
  18. struct udp_cb {
  19.         struct udp_cb *prev;    /* Linked list pointers */
  20.         struct udp_cb *next;
  21.         struct socket socket;   /* Local port accepting datagrams */
  22.         void (*r_upcall)();     /* Function to call when one arrives */
  23.         struct mbuf *rcvq;      /* Queue of pending datagrams */
  24.         int rcvcnt;             /* Count of pending datagrams */
  25. };
  26. extern struct udp_cb *udps[];   /* Hash table for UDP structures */
  27. #define NULLUDP (struct udp_cb *)0
  28.  
  29. /* UDP statistics counters */
  30. struct udp_stat {
  31.         int16 rcvd;             /* Packets received */
  32.         int16 sent;             /* Packets sent */
  33.         int16 cksum;            /* Checksum errors */
  34.         int16 unknown;          /* Unknown socket */
  35.         int16 bdcsts;           /* Incoming broadcasts */
  36. };
  37.  
  38. /* In UDP */
  39. int open_udp(struct socket *, void (*)());
  40. int recv_udp(struct socket *, struct socket *, struct mbuf **);
  41. int send_udp(struct socket *, struct socket *, char, char,
  42.              struct mbuf *, int16, int16, char);
  43. int del_udp(struct socket *);
  44. void udp_dump(struct mbuf **, int32, int32, int);
  45. struct mbuf *htonudp(struct udp *, struct mbuf *, struct pseudo_header *);
  46. void ntohudp(struct udp *, struct mbuf **);
  47.  
  48. /* In UDPCMD */
  49. int doudp(int, char **);
  50. int doudpstat(int, char **);
  51.  
  52. /* In UDPDUMP */
  53. void udp_dump(struct mbuf **, int32, int32, int);
  54.